/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.viettel.bkno.visionone.entities;

import java.io.Serializable;

/**
 *
 * @author hienpt9
 */
public class User implements Serializable {
    //column label
    public static final String USER_ID = "user_id";
    public static final String USERNAME = "username";
    public static final String PASSWORD = "password";
    public static final String EMAIL = "email";
    public static final String FULL_NAME = "full_name";
    public static final String ADDRESS = "address";
    public static final String TELEPHONE = "telephone";
    public static final String ROLE_ID = "role_id";
    
    int userId;
    String username;
    String password;
    String email ="Unknow";
    Role role= Role.NORMAL_USER;
    String fullname="Unknow";
    String address="Unknow";
    String telephone="Unknow";

    public User() {
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getFullname() {
        return fullname;
    }

    public void setFullname(String fullname) {
        this.fullname = fullname;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public Role getRole() {
        return role;
    }

    public void setRole(Role role) {
        this.role = role;
    }

    public boolean isValidFormat() {
        // TODO: Kiem tra xem dinh dang cac thong tin cua User da hop le chua
        // Kiem tra username khong duoc de trong
        // Kiem tra password khong duoc de trong
        // Kiem tra email
        return true;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        com.viettel.bkno.visionone.untils.SecurityManager sm = new com.viettel.bkno.visionone.untils.SecurityManager();
        String pw = sm.genMd5(password);
        this.password = pw;
    }
    
}
